1. Field of the Invention
The present invention relates to a method and apparatus for providing fast data recovery with adaptive pulse code modulation (ADPCM) coding, in particular to a coding technique that can reduce the error rate in the data compression process by simultaneously correcting errors during data output from memory.
2. Description of Related Arts
Currently, pulse code modulation (PCM) is still one of the most commonly used coding techniques, which may be further differentiated between those employing the frequency domain and the time domain in the pulse compression. For ADPCM coding based on the time domain, as shown in FIG. 3, the basic architecture includes an ADPCM encoder (70) and an ADPCM decoder (90) respectively installed on the input and output terminals of a memory device (80). The basic components in an ADPCM encoder (70), as shown in FIG. 4, includes a quantizer (71), a dequantizer (72), a predictor (73), and an adaptive delta tuner (74). As for the architecture of the ADPCM decoder (90), its components include a dequantizer (72), a predictor (73) and an adder (91), as shown in FIG. 5. The decoder (90) is installed in the encoder (70) for authenticating the correctness of data output.
Input data (Di) are processed by the ADPCM encoder (70) in the compression process, and then saved in the memory device (80); conversely, in the decompression process, data are read from the memory device (80) through the ADPCM decoder (90) before outputting to an I/O device.
In actual operation, the predictor (73) first generates an estimated size of the next datum (Px), which is then subtracted from the input signal (Di) by a subtractor (92), generating a variance (Perr). The variance (Perr) should be a micro value in the ideal situation, which is then quantized by the quantizer (71), by step sizing the variable portion, while the fixed portion remains unchanged, so as to generate an output code, given a certain level of resolution. The adaptive delta tuner (74) outputs a delta value and passes it to the quantizer (71) and the dequantizer (72).
When the dequantizer (72) receives the compressed code, it uses the same delta value provided by the adaptive delta tuner (74) under a given resolution, to generate a Qperr signal, which is then added to the prediction value (Px) from the predictor (80) through the service of the adder (91), generating a signal value (Qx) which will be sent back to the input of the predictor (80). The above processes of data value subtraction, variance quantization, and dequantization are to be repeated until the memory operation is completed.
The basic architecture of the ADPCM encoder and decoder as well as the operation theory of the ADPCM coding has been explained above. It is apparent that the quality of output from the adaptive delta tuner (74) and the predictor (73) determines the result of data compression. When an error occurs during data read from the memory device (80), the output value of the ADPCM decoder (90) is altered. For example, in the case of an audio CD, divergence in the decoded data will cause irritating tune burst. Since the ADPCM encoding technique has to rely on changes in two adjacent sampled data to generate a signal output, when an error occurs in the preceding data, a chain reaction will corrupt all subsequent data in the data stream. That is the reason that a tune burst often lasts for a prolonged period until a whole block of data has been processed, or it could be even worse, failing to return to the normal condition altogether.
The present invention is to address these problems in the conventional ADPCM coding technique.
The main object of the present invention is to provide a data coding technique that can correct any error and restore to the original data quickly in the data decoding process by simultaneously correcting data errors during data output from memory.
The data coding technique in accordance with the present invention comprises the steps of:
periodically recording the compressional parameters in the process of writing data to the memory; and
simultaneously retrieving the compressional parameters in the process of reading data from the memory.
When any error occurs in data output, that is data divergence appears on the output of the ADPCM decoder, a data recovery mechanism is invoked by using the compressional parameters accompanying the data read from memory to force the decoder to reproduce the same decompression conditions, thus the output data can be restored to the original value in a relatively short time without affecting succeeding data streams.
The compressional parameters in accordance with the invention refer to the delta value and the resultant data size value (Qx) from the operations of quantization and dequantization.
The second object of the present invention is to provide an effective coding technique that can reduce the error rate in data compression when writing data to memory.
The coding technique in accordance with the invention can further incorporate Gray Codes in the data encoding process in between the ADPCM encoder and the memory device, and for the same reason the data read from memory have to be stripped of Gray Codes first before passing to the ADPCM decoder for data decoding.
Gray Code is a positional binary number expression in which any two adjacent data values having a difference are represented by changes in one data bit, thus effectively reducing the output signal frequency in data transmission, and the chance of creating errors during data write to memory.
The features and structure of the present invention will be more clearly understood when taken in conjunction with the accompanying figures.